<template>
  <div class="tab-container">
    <el-tabs v-model="activeName" @tab-remove="removeTab">
      <el-tab-pane
        v-for="(item, index) in tabMapOptions"
        :key="item.key"
        :label="item.label"
        :name="item.key"
        :closable="index > defaultLength - 1"
      >
        <keep-alive>
          <component
            :is="item.component"
            :tab-name="item.key"
            :refresh="refresh"
            :is-edit="item.isEdit"
            @removeTab="removeTab"
            @editInfo="addTab"
          />
        </keep-alive>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>

import add from './components/add.vue'
import list from './components/list.vue'
import tabInitMixin from '@/mixin/tabInit'

export default {
  name: 'CategoryInfo',

  components: {
    add,
    list
  },

  mixins: [tabInitMixin],

  data() {
    return {
      tabMapOptions: [{
        label: '管理类目详情',
        key: '1',
        component: 'list'
      }, {
        label: '发布类目详情',
        key: '2',
        component: 'add'
      }],
      newLabelName: '编辑类目详情'
    }
  }
}
</script>
